Skip to content

YARN-11993. PublicLocalizer thread exits permanently when pending.remove() returns null - #8755

Open
joseluisll wants to merge 1 commit into
apache:trunkfrom
joseluisll:YARN-11993
Open

joseluisll wants to merge 1 commit into
apache:trunkfrom
joseluisll:YARN-11993

Conversation

@joseluisll

@joseluisll joseluisll commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Depends on (has to be merged first):

Required by (waits for this one to be merged):

Description of PR

In ResourceLocalizationService$PublicLocalizer.run(), when pending.remove(completed) returns null the loop logs "Localized unknown resource" and returns, terminating the Public Localizer thread for the life of the NodeManager. run()'s finally block then shuts the download pool down, so every later public-resource request is rejected — YARN-1800's handler fails each one rather than hanging it, but no public resource can be localized on that node again until the NM restarts. That is the state reported in YARN-9968, which fixed a different branch of this method.

Expected: an unattributable localized resource is skipped and the localizer keeps serving later requests. This PR uses continue, hoisted out of the try.

The branch is defensive rather than reachable today — addResource() puts queue.submit(...) and pending.put(...) in one synchronized (pending) block for exactly this reason. It matters because YARN-11746 proposes shutting the NodeManager down when this thread exits, which would turn one unknown resource into a node-wide outage.

Hoisting the check also makes the assoc dereference in the ExecutionException handler provably safe, clearing NP_NULL_ON_SOME_PATH_EXCEPTION — the only extant SpotBugs warning in this module, which currently costs every NodeManager PR a -1 spotbugs. The exclude entry is therefore deleted rather than repaired; it had been inert since #8568 restored run() without restoring the name YARN-11912 changed to work().

Still leaked, out of scope: the // TODO delete file. Without assoc there is no LocalResourceRequest to fire a failure event for.

How was this patch tested?

New test TestResourceLocalizationService#testPublicLocalizerSurvivesUnknownResource submits a download straight to the completion queue so the Future is never recorded in pending, then asserts the localizer neither dies nor shuts its pool down. Against unmodified trunk it fails with Public Localizer exited after taking an unknown resource; with the fix it passes.

For code changes:

  • Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
  • Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files?

🤖 Generated with Claude Code

@hadoop-yetus

Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 22s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+0 🆗 xmllint 0m 0s xmllint was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ trunk Compile Tests _
+1 💚 shadedclient 19m 32s branch has no errors when building and testing our client artifacts.
-0 ⚠️ patch 19m 47s Used diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary.
_ Patch Compile Tests _
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 shadedclient 14m 58s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 asflicense 0m 25s The patch does not generate ASF License warnings.
36m 33s
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8755/1/artifact/out/Dockerfile
Optional Tests dupname asflicense codespell detsecrets xmllint
uname Linux 83ceec000ab1 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 90f0d1d
Max. process+thread count 637 (vs. ulimit of 10000)
modules C: hadoop-yarn-project/hadoop-yarn U: hadoop-yarn-project/hadoop-yarn
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8755/1/console
versions git=2.43.0 maven=3.9.15
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@joseluisll joseluisll changed the title YARN-11993. Suppress false-positive in ResourceLocalizationService.PublicLocalizer.run() YARN-11993. PublicLocalizer thread dies permanently on an unknown resource Sep 25, 2026
@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 20s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+0 🆗 xmllint 0m 0s xmllint was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
-1 ❌ test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ trunk Compile Tests _
+0 🆗 mvndep 1m 55s Maven dependency ordering for branch
+1 💚 mvninstall 27m 3s trunk passed
+1 💚 compile 3m 35s trunk passed with JDK Ubuntu-21.0.12+8-1-24.04-Ubuntu
+1 💚 compile 3m 31s trunk passed with JDK Ubuntu-17.0.20+8-1-24.04-Ubuntu
+1 💚 checkstyle 1m 25s trunk passed
+1 💚 mvnsite 2m 46s trunk passed
+1 💚 javadoc 2m 55s trunk passed with JDK Ubuntu-21.0.12+8-1-24.04-Ubuntu
+1 💚 javadoc 2m 49s trunk passed with JDK Ubuntu-17.0.20+8-1-24.04-Ubuntu
-1 ❌ spotbugs 6m 53s /branch-spotbugs-hadoop-yarn-project_hadoop-yarn-warnings.html hadoop-yarn-project/hadoop-yarn in trunk has 1 extant spotbugs warnings.
-1 ❌ spotbugs 0m 57s /branch-spotbugs-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-nodemanager-warnings.html hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager in trunk has 1 extant spotbugs warnings.
+1 💚 shadedclient 16m 48s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 19s Maven dependency ordering for patch
+1 💚 mvninstall 4m 29s the patch passed
+1 💚 compile 3m 16s the patch passed with JDK Ubuntu-21.0.12+8-1-24.04-Ubuntu
+1 💚 javac 3m 16s the patch passed
+1 💚 compile 3m 19s the patch passed with JDK Ubuntu-17.0.20+8-1-24.04-Ubuntu
+1 💚 javac 3m 19s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 1m 17s the patch passed
+1 💚 mvnsite 2m 27s the patch passed
+1 💚 javadoc 2m 32s the patch passed with JDK Ubuntu-21.0.12+8-1-24.04-Ubuntu
+1 💚 javadoc 2m 42s the patch passed with JDK Ubuntu-17.0.20+8-1-24.04-Ubuntu
+1 💚 spotbugs 7m 41s hadoop-yarn-project/hadoop-yarn generated 0 new + 0 unchanged - 1 fixed = 0 total (was 1)
+1 💚 spotbugs 1m 1s hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager generated 0 new + 0 unchanged - 1 fixed = 0 total (was 1)
+1 💚 shadedclient 17m 42s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 214m 44s /patch-unit-hadoop-yarn-project_hadoop-yarn.txt hadoop-yarn in the patch failed.
+1 💚 unit 23m 29s hadoop-yarn-server-nodemanager in the patch passed.
+1 💚 asflicense 0m 43s The patch does not generate ASF License warnings.
358m 35s
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8755/2/artifact/out/Dockerfile
GITHUB PR #8755
Optional Tests dupname asflicense codespell detsecrets xmllint compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle
uname Linux 0318aff44c3a 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / d463bd3
Default Java Ubuntu-17.0.20+8-1-24.04-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.12+8-1-24.04-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.20+8-1-24.04-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8755/2/testReport/
Max. process+thread count 1963 (vs. ulimit of 10000)
modules C: hadoop-yarn-project/hadoop-yarn hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager U: hadoop-yarn-project/hadoop-yarn
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8755/2/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

…ove() returns null

When pending.remove(completed) returned null, run() logged "Localized unknown
resource" and returned. That terminated the Public Localizer thread for the life
of the NodeManager, and run()'s finally block shut the download pool down on the
way out. Every later public-resource request was then rejected; YARN-1800's
handler turns each RejectedExecutionException into a
ResourceFailedLocalizationEvent, so containers fail rather than hang, but no
public resource can be localized on that node again until the NM is restarted.
That is the state reported in YARN-9968, which fixed a different branch of this
method. Skip the unattributable resource with continue instead.

The branch is defensive rather than reachable today: addResource() wraps
queue.submit(...) and pending.put(...) in one synchronized (pending) block so a
future cannot complete and be dequeued before the map is updated, and pending is
a synchronizedMap on the same monitor. It matters because YARN-11746 proposes
shutting the NodeManager down when this thread exits, which would turn a single
unknown resource into a node-wide outage.

Hoisting the null check out of the try block also makes the assoc dereference in
the ExecutionException handler provably safe, so SpotBugs no longer reports
NP_NULL_ON_SOME_PATH_EXCEPTION. The exclude entry for it is therefore dropped
rather than repaired; it had been inert since the revert of HADOOP-19668/19670
(apache#8568) restored run() without restoring the method name YARN-11912 changed to
work().

The new test submits a download straight to the completion queue so the Future
is never recorded in pending, then asserts the localizer neither dies nor shuts
its pool down. It fails on the unfixed code with "Public Localizer exited after
taking an unknown resource".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@joseluisll joseluisll changed the title YARN-11993. PublicLocalizer thread dies permanently on an unknown resource YARN-11993. PublicLocalizer thread exits permanently when pending.remove() returns null Sep 25, 2026
@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 25s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+0 🆗 xmllint 0m 0s xmllint was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 2m 44s Maven dependency ordering for branch
+1 💚 mvninstall 32m 23s trunk passed
+1 💚 compile 3m 51s trunk passed with JDK Ubuntu-21.0.12+8-1-24.04-Ubuntu
+1 💚 compile 4m 3s trunk passed with JDK Ubuntu-17.0.20+8-1-24.04-Ubuntu
+1 💚 checkstyle 1m 37s trunk passed
+1 💚 mvnsite 2m 38s trunk passed
+1 💚 javadoc 2m 49s trunk passed with JDK Ubuntu-21.0.12+8-1-24.04-Ubuntu
+1 💚 javadoc 2m 33s trunk passed with JDK Ubuntu-17.0.20+8-1-24.04-Ubuntu
-1 ❌ spotbugs 7m 2s /branch-spotbugs-hadoop-yarn-project_hadoop-yarn-warnings.html hadoop-yarn-project/hadoop-yarn in trunk has 1 extant spotbugs warnings.
-1 ❌ spotbugs 0m 50s /branch-spotbugs-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-nodemanager-warnings.html hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager in trunk has 1 extant spotbugs warnings.
+1 💚 shadedclient 17m 27s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 19s Maven dependency ordering for patch
+1 💚 mvninstall 4m 22s the patch passed
+1 💚 compile 3m 38s the patch passed with JDK Ubuntu-21.0.12+8-1-24.04-Ubuntu
+1 💚 javac 3m 38s the patch passed
+1 💚 compile 3m 43s the patch passed with JDK Ubuntu-17.0.20+8-1-24.04-Ubuntu
+1 💚 javac 3m 43s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 1m 32s the patch passed
+1 💚 mvnsite 3m 0s the patch passed
+1 💚 javadoc 2m 53s the patch passed with JDK Ubuntu-21.0.12+8-1-24.04-Ubuntu
+1 💚 javadoc 2m 50s the patch passed with JDK Ubuntu-17.0.20+8-1-24.04-Ubuntu
+1 💚 spotbugs 7m 11s hadoop-yarn-project/hadoop-yarn generated 0 new + 0 unchanged - 1 fixed = 0 total (was 1)
+1 💚 spotbugs 1m 3s hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager generated 0 new + 0 unchanged - 1 fixed = 0 total (was 1)
+1 💚 shadedclient 18m 27s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 217m 14s /patch-unit-hadoop-yarn-project_hadoop-yarn.txt hadoop-yarn in the patch failed.
-1 ❌ unit 23m 17s /patch-unit-hadoop-yarn-project_hadoop-yarn_hadoop-yarn-server_hadoop-yarn-server-nodemanager.txt hadoop-yarn-server-nodemanager in the patch passed.
+1 💚 asflicense 0m 51s The patch does not generate ASF License warnings.
371m 2s
Reason Tests
Failed junit tests hadoop.yarn.server.nodemanager.containermanager.logaggregation.TestLogAggregationService
hadoop.yarn.server.nodemanager.containermanager.logaggregation.TestLogAggregationService
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8755/3/artifact/out/Dockerfile
GITHUB PR #8755
Optional Tests dupname asflicense codespell detsecrets xmllint compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle
uname Linux c5a924636366 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 4c8d772
Default Java Ubuntu-17.0.20+8-1-24.04-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.12+8-1-24.04-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.20+8-1-24.04-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8755/3/testReport/
Max. process+thread count 1970 (vs. ulimit of 10000)
modules C: hadoop-yarn-project/hadoop-yarn hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager U: hadoop-yarn-project/hadoop-yarn
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8755/3/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants